package cn.hznc.domain.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;
import java.util.List;

/**
 * 指令表
 *
 * @Author Administrator
 * @Date 2023/3/13 15:06
 */
@Getter
@Setter
@Table(name = "t_process")
@TableName(value = "t_process")
public class ProcessEntity {

    @Column(name = "id",type = MySqlTypeConstant.INT,length = 11,isKey = true,isAutoIncrement = true)
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 工艺名称
     */
    @Column(name = "name", type = MySqlTypeConstant.VARCHAR, length = 200)
    private String name;

    /**
     * 工艺内码
     */
    @Column(name = "code", type = MySqlTypeConstant.VARCHAR, length = 200)
    private String code;

    /**
     * 工艺编码
     */
    @Column(name = "process_num", type = MySqlTypeConstant.VARCHAR, length = 200)
    @TableField("process_num")
    private String processNum;

    /**
     * 工艺类型
     */
    @Column(name = "process_type", type = MySqlTypeConstant.VARCHAR, length = 50)
    @TableField("process_type")
    private String processType;

    /**
     * 描述
     */
    @Column(name = "description", type = MySqlTypeConstant.VARCHAR, length = 200)
    @TableField("description")
    private String description;


    /**
     * 版本
     */
    @Column(name = "version", type = MySqlTypeConstant.INT, length = 11)
    @TableField("version")
    private Integer version;

    /**
     * 图号
     */
    @Column(name = "figure_no", type = MySqlTypeConstant.VARCHAR, length = 200)
    @TableField("figure_no")
    private String figureNo;

    /**
     * 状态码
     */
    @Column(name = "status", type = MySqlTypeConstant.TINYINT, length = 4)
    @TableField("status")
    private Integer status;

    /**
     * 状态码
     */
    @Column(name = "create_time", type = MySqlTypeConstant.DATETIME)
    @TableField("create_time")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;


    /**
     * 状态码
     */
    @Column(name = "update_time", type = MySqlTypeConstant.DATETIME)
    @TableField("update_time")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @TableField(exist = false)
    private List<ProductionEntity> child;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ProcessEntity that = (ProcessEntity) o;

        return processNum.equals(that.processNum);
    }

    @Override
    public int hashCode() {
        return processNum.hashCode();
    }
}
